<!--
 * @fbf: fbf
 * @Date: 2022-07-1 15:32:05
 * @LastEditors: jixuanyu
 * @Description: file content
-->
<template>
  <a-popover
    v-model:visible="visible1"
    :trigger="trigger"
    :title="title"
    :disabled="disabled"
    :show-cancel="showCancel"
    :placement="placement"
  >
    <slot name="default" />
    <template v-if="$slots.content" #content>
      <slot name="content" />
    </template>
    <template v-if="$slots.title" #title>
      <slot name="title" />
    </template>
  </a-popover>
</template>
<script>
import { defineComponent, computed } from 'vue'
import { Popover } from 'ant-design-vue'
export default defineComponent({
  name: 'ZPopover',
  components: {
    APopover: Popover
  },
  props: {
    title: {
      type: String,
      default: ''
    },
    placement: {
      type: String,
      default: 'bottom'
    },
    disabled: {
      type: Boolean,
      default: false
    },
    showCancel: {
      type: Boolean,
      default: true
    },
    visible: {
      type: Boolean,
      default: undefined
    },
    trigger: {
      type: String,
      default: 'click'
    }
  },
  setup(props, _ref) {
    const visible1 = computed({
      get() {
        return props.visible
      },
      set(val) {
        _ref.emit('update:visible', val)
      }
    })
    return {
      visible1
    }
  }
})
</script>
